#{extends 'main.html' /}
#{set title:'CoolSoft- Deletion Requests' /}

<body>
<h2>Deletion Requests<h2/><hr/>
<br></br>
<div>
<label>
#{list items:requests, as:'request'}
    User ${request.userName} requests to be deleted from the system
    <br>
    User Details:
    <br></br>
    #{list items:request.user_project_roles,as:'urp'}
     ${request.userName} is a member of ${urp.project.name} with the role ${controllers.Users.getRoleInProject(request.getEntityId(),urp.project.getEntityId())}
  <br></br>
  #{if !controllers.Tasks.getAssignedTasks(request, urp.project.getEntityId()).isEmpty()} 
  #{if !controllers.Users.getRoleInProject(request.getEntityId(),urp.project.getEntityId()).equals("System Admin")}  
  With the following tasks assigned to him/her:
  <br></br>
  #{list items:controllers.Tasks.getAssignedTasks(request, urp.project.getEntityId()) , as:'tasks'}
        ${tasks.description}
        <br></br>
  #{/list}
#{/if}
  #{/if}
  #{else}
    ${request.userName} has no tasks assigned to him in this project
    <br></br>
  #{/else}
    #{/list}
    <label>
    #{form @Users.respondToSystemDeletionRequests(request.getEntityId(),accepted)}
    <input type="radio" name="accepted" value="true" />accept
    
    <br>
    
    <input type="radio" name="accepted" value="false" />reject
    <br>
    <input type="submit" value="Respond" /> 
    <br>
    <br>
    #{/form}
    </label>
#{/list}
</label>
    <br>
    </div>
</body>